package com.qt.regex;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexDemo01 {



    public static void main(String[] args) throws Exception {
        //爬取网络的 信息
        URL url = new URL("https://www.baidu.com");
        URLConnection conn = url.openConnection();
        BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String line;

        String regex = "[登录]";
        Pattern p = Pattern.compile(regex);
        while ((line = br.readLine()) != null){
            Matcher m = p.matcher(line);
            while (m.find()){
                System.out.println(m.group());
            }
        }
        br.close();


    }



}
